<template>
<!-- 左侧项目信息 -->
<div class="app-info-wrapper">
    <div class="zlst-logo" :style="collapsed ? 'text-align: center':''">
        <i class="zlstbd-icon-logo-monochrome m-r-5"></i><span>中铝视拓</span>
    </div>
    <div class="app-info">
        <div class="app-logo">
            <div class="app-icon">
                <!-- <span class="zlstbd-icon-edit"></span> -->
                <img src="../../assets/images/visualization-logo.png"/>
            </div>
        </div>
    </div>
    <div class="app-name">
        <span>展示配置</span>
    </div>
    <div class="line"></div>
</div>
</template>

<script>
import { oneOf } from 'tools'
import { mapGetters } from 'vuex'
import {ZLST_WEB_LOCATION} from '@/api/service/config.js'

export default {

    computed: {
        ...mapGetters(['collapsed', 'userInfo']),
    },

    data () {
        return {
            appType: 'analysis',
            appList: [],
            manipulateShow: false,
            analysisShow: false,
            dataviewShow: false,
            permisionShow: false
        }
    },
    watch: {
        userInfo(val) {
            this.appList = this.userInfo.allSys;
            this.init();
        }
    },

    methods: {
        init() {
            this.manipulateShow = oneOf('manipulate', this.appList);
            this.analysisShow   = oneOf('analysis', this.appList);
            this.dataviewShow   = oneOf('dataview', this.appList);
            this.permisionShow  = oneOf('permission', this.appList);
        },
        transApp(app, appName) {
            this.$refs.poptip.cancel();
            this.$Modal.confirm({
                title: '切换应用',
                content: '确定切换至 ' + appName + ' ?',
                onOk: () => {
                    switch(app) {
                        case 'permission':
                            window.location.href = ZLST_WEB_LOCATION.PERMISSION_URL;
                            break;
                        case 'manipulate':
                            window.location.href = ZLST_WEB_LOCATION.MANIPULATE_URL;
                            break;
                        case 'analysis':
                            window.location.href = ZLST_WEB_LOCATION.ANALYSIS_URL;
                            break;
                    }
                }
            })
        },
    },
}
</script>

<style lang="less">
.app-info-wrapper {
    color:#ffffff;
    padding-bottom: 10px;

    .zlst-logo {
        font-size: 13px;
        padding: 10px 5px;
        opacity:0.6;
    }
    .app-info {

        .app-logo {
            background:#ffffff;
            width:80px;
            height:80px;
            border-radius:100%;
            margin: 15px auto;
            position: relative;
            .app-icon {
                position: absolute;
                top: 20%;
                left: 22%;
                img {
                    width: 48px;
                    height: 48px;
                }
            }
            .put-corner {
                position: absolute;
                bottom: -5px;
                right: 0;
            }
            .change-btn {
                display: block;
                width: 12px;
                height: 12px;
                border-width: 6px;
                border-style: solid;
                border-color: transparent #4082e3 #4082e3 transparent;
            }
        }
    }
    .app-name {
        text-align: center;
        font-size: 22px;
        margin: 19px auto;
    }
    .line {
        border-bottom:1px solid silver;
        opacity:0.35;
        width: 80%;
        margin: 0 auto;
    }
    .ivu-poptip-body {
        padding: 8px 0 0;
    }
    .trans-app {
        color: #000000;
        p {
            color: #a3a3a3;
            margin-bottom: 12px;
            margin-left: 16px;
        }
        li {
            cursor: pointer;
            padding: 0 25px;
        }
        li:hover {
            background: #f7f7f7;
            color: rgba(62, 169, 245, 1);
        }
        .trans-logo {
            vertical-align: middle;
            display: inline-block;
            background:#f0f2f5;
            width:64px;
            height:64px;
            border-radius:100%;
            .img {
                margin: 12px auto;
                width: 40px;
                height: 40px;
                img {
                    width: 40px;
                    height: 40px;
                }
            }

        }
    }
}
</style>
